<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title> 挖一下图集发布 Powered By PHPKind </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- 使用QLib控件是必须包含样式表 -->
<link type="text/css" rel="stylesheet" href="{$app:qlib}/ui.css" />
<style>
#screen {
width:100%;
height: 600px;
overflow: auto;
background: #000;
color: #cccccc;
}

/*CSS page style pagination*/

DIV.pager {
	PADDING-RIGHT: 0px; 
	PADDING-LEFT: 0px; 
	FONT-SIZE: 15px; 
	PADDING-BOTTOM: 10px; 
	COLOR: #48b9ef; 
	PADDING-TOP: 10px; 
	FONT-FAMILY: Arial, Helvetica, sans-serif; 
	BACKGROUND-COLOR: #fff; 
	TEXT-ALIGN: left;
	text-indent:5px;
}

DIV.pager A {
	BORDER: #f0f0f0 2px solid;
	PADDING-TOP: 8px; 
	PADDING-RIGHT: 12px; 
	PADDING-BOTTOM: 8px; 
	PADDING-LEFT: 12px; 
	MARGIN: 0px 2px; 
	COLOR: #48b9ef; 		
	TEXT-DECORATION: none
}

DIV.pager A:hover {
	BORDER: #ff5a00 2px solid; COLOR: #ff5a00;
}
DIV.pager A:active {
	BORDER: #ff5a00 2px solid; COLOR: #ff5a00;
}
DIV.pager SPAN.current {
	PADDING-TOP: 8px; 
	PADDING-RIGHT: 12px; 
	PADDING-BOTTOM: 8px; 
	PADDING-LEFT: 12px; 
	MARGIN: 0px 2px 0px 0px;
	BORDER: #ff5a00 2px solid; 
	BACKGROUND-COLOR: #ff6c16;
	
	COLOR: #fff;  
}

DIV.pager SPAN.disabled {
	DISPLAY: none
}


</style>

<script src="{$app:qlib}/Q.js">
<!--
import utils.tween;
import utils.stl;
import utils.json2;
import utils.ajax;
import utils.xml;
import ui.wndx-1-0-2;
-->
</script>
<script src="{$themes:path}/common.js"></script>
<script>
<!--

var SELECTNONE		= 0;
var SELECTALL 		= 1;
var SELECTREVERSE	= 2;

function doSelectItem(type){
	var f=Q.$('form1');
	var cids = [];
	var nodelist = f["task_id[]"];
	if(type == SELECTREVERSE) {
		for(var i=0; i < nodelist.length; i++ ) {
			nodelist[i].checked = !nodelist[i].checked;
		}
	} else {
		var value = (type == SELECTALL) ? true : false;
		for(var i=0; i < nodelist.length; i++ ) {
			nodelist[i].checked = value;
		}
	}
}


Q.Ready(function() {

Q.setdebug(Q.$('debug'));
Q.debug(true);

Q.$('button-public').onclick=function(){
  //<input name="title[]" type="hidden" value="[field:title]">
  //<input name="pageUrl[]" type="hidden" value="[field:pageUrl]">
  //<input name="imgSrc[]" type="hidden" value="[field:imgSrc]">
  //<input name="album_id[]" type="hidden" value="[field:album_id]">
  
  var f = Q.$("form1");
  var items = f["task_id[]"];
  var items_title = f["title[]"];
  var items_pageUrl = f["pageUrl[]"];
  var items_imgSrc = f["imgSrc[]"];
  var items_album_id = f["album_id[]"];

  var len = items.length;
  var tasks = [];
  for(var i=0; i < len; i++ ) {
    if(items[i].checked && !items[i].disabled) {
      tasks.push({img: {
        pageUrl : items_pageUrl[i].value,
        srcUrl : items_imgSrc[i].value, 
        cookie : document.cookie,
        title : items_title[i].value,
        albumid : items_album_id[i].value,
      }});
    }
  }
  //var json_data = {};
  //json_data.pageUrl = location.href;
  //json_data.srcUrl = inner_img.src, 
  //json_data.cookie = document.cookie,
  //json_data.title = document.title,
  //json_data.albumid = 0;
  //img: json_data

  task_execute({
    'api' : '/index.php?app=wayixia&mod=api&action=public-wa&inajax=true',
    'tasks' : tasks,
    'task_onok' : function(task, response) {
      if(response && response.header == 0) {
		Q.printf('public ok');
	  }
      
    },
    'task_oncompleted' : function() {
      Q.printf('public task_oncompleted');
    }  
  });
}

Q.$("form1").onsubmit = function() {
  return false;
}

var chkAll = Q.$('idCheckAll');
  if(chkAll) {
        chkAll.onchange = function() {
            if(this.checked) {
                doSelectItem(SELECTALL);
            } else {
                doSelectItem(SELECTNONE);
            }
        }
}
});

//-->
</script>

<body>
<h4>
预发布 画集列表列表

</h4>
<form id="form1">
<html:table 
	id="mydata2" 
	datasrc="data://publicdata" 
	pagesize="15"
	cellpadding="3" 
	cellspacing="1"
	style="background: #333; width: 1000px; color:#F0F0F0; font-size: 13px;"
	valueSelected="key:value"
>
<thead style="background:red; color:white;">
<th width="50" align="left"><input id="idCheckAll" type=checkbox></th>
<th width="300" align="left">title</th>
<th width="400" align="left">imgSrc</th>
</thead>
<t:data>
<tr 
onmouseover="this.style.backgroundColor='#FFFF00'; this.style.color='#000';"
onmouseout="this.style.backgroundColor=''; this.style.color='#FFF';"
>
<td width="50" align="left">
	<input name="task_id[]" type="checkbox" value="[field:id]">
</td>
<td>
	<input name="title[]" type="hidden" value="[field:title]">
  <input name="pageUrl[]" type="hidden" value="[field:pageUrl]">
  <input name="imgSrc[]" type="hidden" value="[field:imgSrc]">
  <input name="album_id[]" type="hidden" value="[field:album_id]">
	[field:title]
</td>
<td>[field:imgSrc]</td>
</tr>
</t:data>
</html:table>
</form>
<br>
<div class="pager">	{$fields:pager}	</div>
<br>
<button id="button-public">发布</button>
<br>
<br>
<div id="debug" style="background: yellow;height: 260px;width: 1000px;overflow: auto;">

</div>

</body>
</html>
